package com.miracle.travel.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.miracle.travel.mapper.TravelSceneryInfoMapper;
import com.miracle.travel.domain.TravelSceneryInfo;
import com.miracle.travel.service.ITravelSceneryInfoService;

/**
 * 景点信息Service业务层处理
 * 
 * @author miracle
 * @date 2023-04-24
 */
@Service
public class TravelSceneryInfoServiceImpl implements ITravelSceneryInfoService 
{
    @Autowired
    private TravelSceneryInfoMapper travelSceneryInfoMapper;

    /**
     * 查询景点信息
     * 
     * @param id 景点信息主键
     * @return 景点信息
     */
    @Override
    public TravelSceneryInfo selectTravelSceneryInfoById(Integer id)
    {
        return travelSceneryInfoMapper.selectTravelSceneryInfoById(id);
    }

    /**
     * 查询景点信息列表
     * 
     * @param travelSceneryInfo 景点信息
     * @return 景点信息
     */
    @Override
    public List<TravelSceneryInfo> selectTravelSceneryInfoList(TravelSceneryInfo travelSceneryInfo)
    {
        return travelSceneryInfoMapper.selectTravelSceneryInfoList(travelSceneryInfo);
    }

    /**
     * 新增景点信息
     * 
     * @param travelSceneryInfo 景点信息
     * @return 结果
     */
    @Override
    public int insertTravelSceneryInfo(TravelSceneryInfo travelSceneryInfo)
    {
        travelSceneryInfo.setCreateNo(SecurityUtils.getUsername());
        travelSceneryInfo.setCreateTime(DateUtils.getNowDate());
        return travelSceneryInfoMapper.insertTravelSceneryInfo(travelSceneryInfo);
    }

    /**
     * 修改景点信息
     * 
     * @param travelSceneryInfo 景点信息
     * @return 结果
     */
    @Override
    public int updateTravelSceneryInfo(TravelSceneryInfo travelSceneryInfo)
    {
        travelSceneryInfo.setUpdateNo(SecurityUtils.getUsername());
        travelSceneryInfo.setUpdateTime(DateUtils.getNowDate());
        return travelSceneryInfoMapper.updateTravelSceneryInfo(travelSceneryInfo);
    }

    /**
     * 批量删除景点信息
     * 
     * @param ids 需要删除的景点信息主键
     * @return 结果
     */
    @Override
    public int deleteTravelSceneryInfoByIds(Integer[] ids)
    {
        return travelSceneryInfoMapper.deleteTravelSceneryInfoByIds(ids);
    }

    /**
     * 删除景点信息信息
     * 
     * @param id 景点信息主键
     * @return 结果
     */
    @Override
    public int deleteTravelSceneryInfoById(Integer id)
    {
        return travelSceneryInfoMapper.deleteTravelSceneryInfoById(id);
    }

    @Override
    public List<TravelSceneryInfo> getMapData() {
        List<TravelSceneryInfo> travelSceneryInfos = travelSceneryInfoMapper.selectTravelSceneryInfoList(new TravelSceneryInfo());
        return travelSceneryInfos;
    }
}
